<template>
  <div class="comment">
    <detail-section title="热门评论" more-text="查看全部37条评论">
      <div class="comment-inner">
        <div class="header">
          <div class="left">
            <div class="score">
              <div class="text">{{ comment.overall }}</div>
              <div class="line"></div>
            </div>
            <div class="info">
              <div class="title">{{ comment.scoreTitle }}</div>
              <div class="count">{{ comment.totalCount }}条评论</div>
              <div class="star">
                <van-rate v-model="comment.overall" color="#ff9645" size="12" readonly allow-half />
              </div>
            </div>
          </div>
          <div class="right">
            <template v-for="(item, index) in comment.subScores" :key="index">
              <div class="item">{{ item }}</div>
            </template>
          </div>
        </div>

        <div class="tags">
          <template v-for="(iten, indey) in comment.commentTagVo" :key="indey">
            <div class="iten">{{ iten.text }}</div>
          </template>
        </div>

        <div class="comment-infos">
          <div class="user">
            <div class="avatar">
              <img :src="comment.comment.userAvatars" alt="">
            </div>
            <div class="user-info">
              <div class="name">{{ comment.comment.userName }}</div>
              <div class="date">{{ comment.comment.checkInDate }}</div>
            </div>
          </div>
          <div class="text">
            {{ comment.comment.commentDetail }}
          </div>
        </div>
      </div>
    </detail-section>
  </div>
</template>

<script setup>
  import DetailSection from "@/components/detail-section/detail-section.vue"

  const props = defineProps({
    comment: {
      type: Object,
      default: () => ({})
    }
  })


</script>

<style lang="less" scoped>
  .comment-inner {
    display: flex;
    flex-direction: column;
    color: #333;
    font-size: 12px;

    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 10px;

      .left {
        display: flex;
        .score {
          width: 65px;
          position: relative;

          .text {
            font-weight: 700;
            font-size: 12.8vw;
            z-index: 9;
          }
          .line {
            width: 17.6vw;
            height: 1.6vw;
            background: linear-gradient(90deg, #fa8c1d, #fcaf3f);
            border-radius: 0.8vw;
            position: absolute;
            bottom: 0px;
            z-index: 5;
          }
        }

        .info {
          margin-left: 20px;

          .count {
            color: #999;
            margin: 5px 0;
          }
        }
      }

      .right {
        display: flex;
        flex-wrap: wrap;
        flex: 1;
        justify-content: flex-end;

        .item {

          color: #666;
          margin: 0 0 5px 5px;
        }
      }
    }

    .tags {
      display: flex;
      flex-wrap: wrap;
      margin-top: 15px;

      .iten {
        color: #666;
        margin: 10px 10px 0 0;
        background-color: #f5f5f5;
        padding: 0.8vw 1.33333vw;
        border-radius: 2.13333vw;
      }
    }

    .comment-infos {
      margin-top: 15px;
      padding: 2.66667vw;
      border-radius: 1.6vw;
      background-color: #f7f9fb;

      .user {
        display: flex;
        .avatar {
          img {
            width: 8.53333vw;
            height: 8.53333vw;
            border-radius: 50%;
          }
        }

        .user-info {
          margin-left: 10px;

          .name {
            font-size: 14px;
            color: #000;
          }

          .date {
            color: #999;
            margin-top: 6px;
          }
        }
      }

      .text {
        margin-top: 20px;
        line-height: 1.25;
      }
    }
  }
</style>